home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Science⁄Math / VideoToolbox / Utilities / Quick3 / MyFgets.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-13  |  531 b   |  23 lines  |  [TEXT/KAHL]

  1. /*
  2. MyFgets.c
  3.  
  4. A version of fgets() that, like gets(), strips the trailing '\n'.
  5. Please DON'T use this. It was a BAD idea.
  6.  
  7. HISTORY:
  8. god knows when dgp wrote it.
  9. 12/1/92    dgp fixed stupid error of deleting last character without first
  10.             making sure that it's an '\n'
  11. */
  12. #include "VideoToolbox.h"
  13. char *MyFgets(char *s, int length, FILE *stream);
  14.  
  15. char *MyFgets(char *s, int length, FILE *stream)
  16. {
  17.     int i;
  18.     
  19.     fgets(s,length,stream);
  20.     i=strlen(s);
  21.     if(i>0 && i<length && s[i-1]=='\n') s[i-1]=0;    /* strip trailing "\n" */
  22.     return s;
  23. }